
function getMostWord(article) {
    if (!article) return;
    article = article.trim().toLowerCase();
    let wordlist = article.match(/[a-z]+/g);
    let visited = [];
    let maxNum = 0;
    let maxWord = '';
    article = " " + wordlist.join(" ") + " ";
    wordlist.forEach(item => {
        if (visited.indexOf(item) < 0) {
            visited.push(item);
            let regexp = new RegExp(" " + item + " ", g);
            let num = article.match(regexp).length;
            if (num > maxNum) {
                maxWord = item;
                maxNum = num;
            }
        }
    })
    return maxWord;
}

// let str = "item item hh item hh";
// console.log(str.match(/item/g).length);